export default{
    data(){
        return {
		   // 默认全局分享内容
            mixinsShare:{
                title:'律动引擎',  //分享标题
                path:'/pages/index/index?user_id=' +  uni.getStorageSync("myuserid"), // 分享路径
                imageUrl:'',    //分享图片
                desc:'律动引擎',  //描述
                content:''  //内容
            }
        }
    },

	//分享好友
    onShareAppMessage(res) {
		//不传路径 则默认获取当前路径及附带参数
		if(!this.mixinsShare.path){
			this.mixinsShare.path=getCurrentPages()[0].$page.fullPath
		}
        return {
            title:this.mixinsShare.title,
            path:this.mixinsShare.path,
            imageUrl:this.mixinsShare.imageUrl,
            desc:this.mixinsShare.desc,
            content:this.mixinsShare.content,
            success(res){
                uni.showToast({
                    title:'分享成功'
                })
            },
            fail(res){
                uni.showToast({
                    title:'分享失败',
                    icon:'none'
                })
            }
        }
    },
	// 分享朋友圈
	onShareTimeline(res) {
		//不传路径 则默认获取当前路径及附带参数
		if(!this.mixinsShare.path){
			this.mixinsShare.path=getCurrentPages()[0].$page.fullPath
		}
	    return {
	        title:this.mixinsShare.title,
	        path:this.mixinsShare.path,
	        imageUrl:this.mixinsShare.imageUrl,
	        desc:this.mixinsShare.desc,
	        content:this.mixinsShare.content,
	        success(res){
	            uni.showToast({
	                title:'分享成功'
	            })
	        },
	        fail(res){
	            uni.showToast({
	                title:'分享失败',
	                icon:'none'
	            })
	        }
	    }
	}
}

